#pragma once
#include <string>
#include <queue>
#include <mutex>
#include <future>

class XExec
{
private:
    bool running_ = false;
    std::queue<std::string> out_queue_;
    std::mutex mutx_;
    std::future<bool> fut_;

public:
    XExec();
    ~XExec();

    bool Start(std::string cmd);

    bool Running() const { return running_; }

    bool GetOutput(std::string &str);

    void Wait()
    {
        running_ = false;
        fut_.get();
    }
};
